/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.bytedance.scene.animation.interaction.progressanimation;

import ohos.agp.components.Component;
import ohos.utils.ObjectAttribute;

/**
 * ComponentAttribute.
 *
 * @since 2021-06-16
 */
public final class ComponentAttribute {
    /**
     * TRANSLATION_X
     */
    public static final ObjectAttribute<Component, Float> TRANSLATION_X =
            new ObjectAttribute<Component, Float>(Float.class, "translationX") {
                @Override
                public void set(Component obj, Float value) {
                    obj.setTranslationX(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getTranslationX();
                }

            };

    /**
     * TRANSLATION_Y
     */
    public static final ObjectAttribute<Component, Float> TRANSLATION_Y =
            new ObjectAttribute<Component, Float>(Float.class, "translationY") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setTranslationY(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getTranslationY();
                }
            };

    /**
     * SCALE_X
     */
    public static final ObjectAttribute<Component, Float> SCALE_X =
            new ObjectAttribute<Component, Float>(Float.class, "scaleX") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setScaleX(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getScaleX();
                }
            };

    /**
     * SCALE_X
     */
    public static final ObjectAttribute<Component, Float> SCALE_Y =
            new ObjectAttribute<Component, Float>(Float.class, "scaleY") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setScaleY(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getScaleY();
                }
            };

    /**
     * ROTATION
     */
    public static final ObjectAttribute<Component, Float> ROTATION =
            new ObjectAttribute<Component, Float>(Float.class, "rotation") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setRotation(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getRotation();
                }
            };

    /**
     * X
     */
    public static final ObjectAttribute<Component, Float> X =
            new ObjectAttribute<Component, Float>(Float.class, "contentPositionX") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setContentPositionX(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getContentPositionX();
                }
            };

    /**
     * Y
     */
    public static final ObjectAttribute<Component, Float> Y =
            new ObjectAttribute<Component, Float>(Float.class, "contentPositionY") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setContentPositionY(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getContentPositionY();
                }
            };

    /**
     * ALPHA
     */
    public static final ObjectAttribute<Component, Float> ALPHA =
            new ObjectAttribute<Component, Float>(Float.class, "alpha") {

                @Override
                public void set(Component obj, Float value) {
                    obj.setAlpha(value);
                }

                @Override
                public Float get(Component object) {
                    return object.getAlpha();
                }
            };
    private ComponentAttribute() {
    }
}
